AS=/usr/local/mips-cross/bin/mipsel-elf-as
CC=/usr/local/mips-cross/bin/mipsel-elf-gcc
LD=/usr/local/mips-cross/bin/mipsel-elf-ld
OBJCOPY=/usr/local/mips-cross/bin/mipsel-elf-objcopy
OBJDUMP=/usr/local/mips-cross/bin/mipsel-elf-objdump

all:
	$(AS) -mips1 memtest.S -o memtest.o -EL -g
	$(LD) -mips1 -T ../../lib/default.ld memtest.o -o memtest.elf -EL -g
	$(OBJCOPY) -j .startup.bootvec -j .startup -O binary memtest.elf memtest.bin
	hexdump -e "1/4 \"%08x\n\"" memtest.bin -v > memtest.hex
	cat ../../lib/nops.hex >> memtest.hex
	
dump:
	$(OBJDUMP) -j .startup.bootvec -j .startup -S -D memtest.elf -z

symbols:
	$(OBJDUMP) -t memtest.elf

sections:
	$(OBJDUMP) -h memtest.elf

clean:
	rm -f memtest.bin memtest.elf memtest.hex memtest.o
